local hx__huoshan = fk.CreateSkill{
    name = "hx__huoshan",

    tags = {Skill.Limited},
}

hx__huoshan:addEffect("active",{
    prompt = "hx__huoshan__prompt",
    can_use = function (self, player)
        return player:usedSkillTimes(hx__huoshan.name,Player.HistoryGame) == 0 and player.maxHp > 0
    end,
    interaction = function (self, player)
        return UI.Spin{from = 1, to = player.maxHp,default = 1}
    end,
    min_target_num = 1,
    target_filter = function (self, player, to_select, selected, selected_cards)
        return to_select ~= player
    end,
    card_num = 0,
    card_filter = Util.FalseFunc,
    on_use = function (self, room, effect)
        local player = effect.from
        local num = self.interaction.data
        room:changeMaxHp(player,-num)
        for _, v in ipairs(effect.tos) do
            room:damage{
                to = v,
                damage = num,
                from = player,
                damageType = fk.FireDamage,
            }
        end
    end,
})

hx__huoshan:addEffect(fk.EnterDying,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(hx__huoshan.name) and target and target == player and player:usedSkillTimes(hx__huoshan.name,Player.HistoryGame) == 0 and player.maxHp > 0
    end,
    on_cost = function (self, event, target, player, data)
      local suc,_ =  player.room:askToUseActiveSkill(player,{skill_name = hx__huoshan.name, cancelable = true ,})
      if suc then
        return true
      end
    end,
})

return hx__huoshan